<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><{ $webtitle }></title>
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="../js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="../js/admin.js"></script>
</head>

<body >

<form id="giftsend" method="post" action="?action=send" onsubmit="return checkItem();">
<table class="tb_main">
	<thead>
		<tr class="tb_title"><th colspan="3"><{ $lang.single_reward }></th></tr>
	</thead>
	
	<tbody>
     	<tr>
     		<td class="tdTitle"><{ $lang.email_title }></td>
     		<td align="left"><input type="text" size="80" id="emailtitle" name="emailtitle"/></td>
     	</tr>
     	
     	<tr>
     		<td class="tdTitle"><{ $lang.email_content }></td>
     		<td align="left"><textarea cols="80" rows="5" id="emailcontent" name="emailcontent"></textarea></td>
     	</tr>
     	
     	<tr>
     		<td class="tdTitle">
   				<{ $lang.reward_user }><br/><br />
			</td>
			<td align="left">
			   	<button type="button" class="nick-name"><{ $lang.nickname }></button>
			   	<button type="button" class="login-name"><{ $lang.loginname }></button><br/>
   				<textarea tabindex="3" id="account"  class="account-textarea" ></textarea>
       		</td>
		</tr>
		
		<tr>
			<td class="tdTitle"><{ $lang.reason }></td>
			<td align="left">
				<input tabindex="4" type="text" id="sendtitle" name="sendtitle" size="50" onkeyup="checkTitle();" value="<{$giftdata.sendtitle}>" />
				<span style="color:red;margin:5px;" id="sendtitle_error"></span>
			</td>
		</tr>
		
  		<{ foreach from=$giftArray item=item key=key}>
		<tr>
			<{if $key == 0}>
			<td class="tdTitle" rowspan="7"><{ $lang.item_setting }><br/><font color="green">★<{ $lang.item_setting_remind }></font></td>
			<{/if}>
     		<td align="left">
   					<{ $lang.item }><{$item}>：
   					<select class="selectoption"  id="itemtype_<{$key}>" name="itemtype[]" onchange="showDaoju(<{$key}>);">
		  				<{html_options options=$arrRes selected=$giftdata.data.$key.itemtype}>
 			 		</select>
 			 			
	 				<{ $lang.quantity }>：
	 				<input  type="text" onblur="checkItem();" id="itemnum_<{$key}>" name="itemnum[]" style="width:55px;" maxlength="7" value="<{$giftdata.data.$key.itemnum}>" />
	 				
	 			 	<span id="daoju_<{$key}>"<{if $giftdata.data.$key.itemtype != 1}> class="sClose"<{/if}>>
	 			 	<{ $lang.daoju }>ID：
	 			 	<input type="text" onblur="getItemName(<{$key}>);" id="itemid_<{$key}>" name="itemid[]" class="sText" value="<{$giftdata.data.$key.itemid}>" />
	 				<{ $lang.or }> 
	 				<{ $lang.item_name }>：
	 				<input type="text" id="itemname_<{$key}>" name="itemname[]" value="<{$giftdata.data.$key.itemname}>" onchange="getItemId(<{$key}>);" class="sText" />
					<span style="color:#F00" id="daoju_error_<{$key}>"></span>
	 				</span>
	 				
	 				<input type="radio" name="isBind[<{$key}>]" id="isBind" value="1" checked="checked"/><label><{ $lang.bind }></label>
		  			<input type="radio" name="isBind[<{$key}>]" id="isBind" value="0"/><label><{ $lang.not_bind }></label>
     		</td>
        </tr>
 		<{ /foreach }>
     
     <tr>
     	<td colspan="2">
			<input onmouseout="this.style.borderColor='#00843D'" onmouseover="this.style.borderColor='#75cd02'" class="sendButton" type="submit" id="submitid" value="<{ $lang.send }>"/>
			<input onmouseout="this.style.borderColor='#00843D'" onmouseover="this.style.borderColor='#75cd02'" class="resetButton" type="reset" value="<{ $lang.reset }>" />
		</td>
	</tr>
	</tbody>
</table>
</form>

<script type="text/javascript">
$(document).ready(function(){
	$('.nick-name').trigger('click');
});
$('.nick-name').click(function(){
	$('#account').attr('name','nickname');
	$(this).addClass('account-selected');
	$('.login-name').removeClass('account-selected');
});
$('.login-name').click(function(){
	$('#account').attr('name','loginname');
	$(this).addClass('account-selected');
	$('.nick-name').removeClass('account-selected');
});

//用户是否存在校验
$('.account-textarea').blur(function(){
	var accounts = $('#account').val();
	if(accounts == null){
		return false;
	}
	var type = $('#account').attr('name');
	$.getJSON('?action=check',{'accounts':accounts,'type':type},function (msg){
		if(msg!=null) 
		{
			$('.account-textarea').next().remove();
			msg = '<p>('+msg+')'+'不存在,请查证！</p>';
			$('.account-textarea').after(msg);
			user_flag = false;
		}
		else
		{
			$('.account-textarea').next().remove();
			user_flag = true;
		}
	});
});



</script>

</body>
</html>